<?php 
		$user="root";
		$password="";
		$database="whitehouse";
		mysql_connect(localhost,$user,$password);
		@mysql_select_db($database) or die( "Unable to select database");
		
	$query = "SELECT * from unit";
		$result = mysql_query($query);
		$i=0;
		while($row = mysql_fetch_array( $result )){
		//	echo $row['unit']."<br />";
			//echo $row['id']."<br />";
			if($row['isoccupied']==0){
			$status[$row["unit_name"]]="un";

			}
			$i++;
		}

?>
<h2>Units</h2>
<table id="unitstable">
<tr>
	<td><div class="<?php echo $status["A1"];?>occupied">A1</div></td>
	<td><div class="<?php echo $status["A2"];?>occupied">A2</div></td>
	<td><div class="<?php echo $status["A3"];?>occupied">A3</div></td>
	<td><div class="<?php echo $status["A4"];?>occupied">A4</div></td>
	<td><div class="<?php echo $status["A5"];?>occupied">A5</div></td>
	<td><div class="<?php echo $status["A6"];?>occupied">A6</div></td>
	<td><div class="<?php echo $status["A7"];?>occupied">A7</div></td>
	<td><div class="<?php echo $status["A8"];?>occupied">A8</div></td>
	<td><div class="<?php echo $status["A9"];?>occupied">A9</div></td>
</tr>
<tr>
	<td><div class="<?php echo $status["B1"];?>occupied">B1</div></td>
	<td><div class="<?php echo $status["B2"];?>occupied">B2</div></td>
	<td><div class="<?php echo $status["B3"];?>occupied">B3</div></td>
	<td><div class="<?php echo $status["B4"];?>occupied">B4</div></td>
	<td><div class="<?php echo $status["B5"];?>occupied">B5</div></td>
	<td><div class="<?php echo $status["B6"];?>occupied">B6</div></td>
	<td><div class="<?php echo $status["B7"];?>occupied">B7</div></td>
	<td><div class="<?php echo $status["B8"];?>occupied">B8</div></td>
	<td><div class="<?php echo $status["B9"];?>occupied">B9</div></td>
</tr>
<tr>
	<td><div class="<?php echo $status["C1"];?>occupied">C1</div></td>
	<td><div class="<?php echo $status["C2"];?>occupied">C2</div></td>
	<td><div class="<?php echo $status["C3"];?>occupied">C3</div></td>
	<td><div class="<?php echo $status["C4"];?>occupied">C4</div></td>
	<td><div class="<?php echo $status["C5"];?>occupied">C5</div></td>
	<td><div class="<?php echo $status["C6"];?>occupied">C6</div></td>
	<td><div class="<?php echo $status["C7"];?>occupied">C7</div></td>
	<td><div class="<?php echo $status["C8"];?>occupied">C8</div></td>
	<td><div class="<?php echo $status["C9"];?>occupied">C9</div></td>
</tr><tr>
	<td><div class="<?php echo $status["D1"];?>occupied">D1</div></td>
	<td><div class="<?php echo $status["D2"];?>occupied">D2</div></td>
	<td><div class="<?php echo $status["D3"];?>occupied">D3</div></td>
	<td><div class="<?php echo $status["D4"];?>occupied">D4</div></td>
	<td><div class="<?php echo $status["D5"];?>occupied">D5</div></td>
	<td><div class="<?php echo $status["D6"];?>occupied">D6</div></td>
	<td><div class="<?php echo $status["D7"];?>occupied">D7</div></td>
	<td><div class="<?php echo $status["D8"];?>occupied">D8</div></td>
	<td><div class="<?php echo $status["D9"];?>occupied">D9</div></td>
</tr><tr>
	<td><div class="<?php echo $status["E1"];?>occupied">E1</div></td>
	<td><div class="<?php echo $status["E2"];?>occupied">E2</div></td>
	<td><div class="<?php echo $status["E3"];?>occupied">E3</div></td>
	<td><div class="<?php echo $status["E4"];?>occupied">E4</div></td>
	<td><div class="<?php echo $status["E5"];?>occupied">E5</div></td>
	<td><div class="<?php echo $status["E6"];?>occupied">E6</div></td>
	<td><div class="<?php echo $status["E7"];?>occupied">E7</div></td>
	<td><div class="<?php echo $status["E8"];?>occupied">E8</div></td>
	<td><div class="<?php echo $status["E9"];?>occupied">E9</div></td>
</tr><tr>
	<td><div class="<?php echo $status["F1"];?>occupied">F1</div></td>
	<td><div class="<?php echo $status["F2"];?>occupied">F2</div></td>
	<td><div class="<?php echo $status["F3"];?>occupied">F3</div></td>
	<td><div class="<?php echo $status["F4"];?>occupied">F4</div></td>
	<td><div class="<?php echo $status["F5"];?>occupied">F5</div></td>
	<td><div class="<?php echo $status["F6"];?>occupied">F6</div></td>
	<td><div class="<?php echo $status["F7"];?>occupied">F7</div></td>
	<td><div class="<?php echo $status["F8"];?>occupied">F8</div></td>
	<td><div class="<?php echo $status["F9"];?>occupied">F9</div></td>
</tr><tr>
	<td><div class="<?php echo $status["G1"];?>occupied">G1</div></td>
	<td><div class="<?php echo $status["G2"];?>occupied">G2</div></td>
	<td><div class="<?php echo $status["G3"];?>occupied">G3</div></td>
	<td><div class="<?php echo $status["G4"];?>occupied">G4</div></td>
	<td><div class="<?php echo $status["G5"];?>occupied">G5</div></td>
	<td><div class="<?php echo $status["G6"];?>occupied">G6</div></td>
	<td><div class="<?php echo $status["G7"];?>occupied">G7</div></td>
	<td><div class="<?php echo $status["G8"];?>occupied">G8</div></td>
	<td><div class="<?php echo $status["G9"];?>occupied">G9</div></td>
</tr><tr>
	<td><div class="<?php echo $status["H1"];?>occupied">H1</div></td>
	<td><div class="<?php echo $status["H2"];?>occupied">H2</div></td>
	<td><div class="<?php echo $status["H3"];?>occupied">H3</div></td>
	<td><div class="<?php echo $status["H4"];?>occupied">H4</div></td>
	<td><div class="<?php echo $status["H5"];?>occupied">H5</div></td>
	<td><div class="<?php echo $status["H6"];?>occupied">H6</div></td>
	<td><div class="<?php echo $status["H7"];?>occupied">H7</div></td>
	<td><div class="<?php echo $status["H8"];?>occupied">H8</div></td>
	<td><div class="<?php echo $status["H9"];?>occupied">H9</div></td>
</tr>
</table>